﻿@model Logistics.Web.Models.Order.LocationAddressModel

@using Telerik.Web.Mvc
@using Telerik.Web.Mvc.UI
@using Nop.Core.Domain.Common

@using (Html.BeginForm("BillingAddress", "Order", FormMethod.Post))
{
    <div class="address-select-wrapper">
        <div class="address-form">
            <h2>Billing Address</h2>
            <p>Please fill in your billing address.</p>
            @if (Model.Addresses.Count > 0)
            {
                <input type="button" class="address-select btn btn-normal" value="Select from Saved Addresses" />
            }
            <div>
                @*@Html.RequiredHint()<span>= Mandatory fields</span>*@
                <div class="location-group">
                    <div class="col-ms-12 col-xs-12 col-sm-6 col-md-6 col-lg-6">
                        @Html.RequiredHint()
                        @Html.LabelFor(model => model.Address.FirstName)
                        @Html.TextBoxFor(model => model.Address.FirstName, new { @class = "form-control" })
                    </div>

                    <div class="col-ms-12 col-xs-12 col-sm-6 col-md-6 col-lg-6">
                        @Html.RequiredHint()
                        @Html.LabelFor(model => model.Address.LastName)
                        @Html.TextBoxFor(model => model.Address.LastName, new { @class = "form-control" })
                    </div>
                </div>

                <div class="location-group my-location-company col-ms-12 col-xs-12 col-sm-12 col-md-12 col-lg-12">
                    @Html.LabelFor(model => model.Address.Company)
                    @Html.TextBoxFor(model => model.Address.Company, new { @class = "form-control", @placeholder = "Optional" })
                </div>

                <div class="location-group col-ms-12 col-xs-12 col-sm-12 col-md-9 col-lg-9">
                    @Html.RequiredHint()
                    @Html.LabelFor(model => model.Address.Address1)
                    @Html.TextBoxFor(model => model.Address.Address1, new { @class = "form-control" })
                </div>
                <div class="location-group col-ms-12 col-xs-12 col-sm-12 col-md-3 col-lg-3">
                    @Html.LabelFor(model => model.Address.Address2)
                    @Html.TextBoxFor(model => model.Address.Address2, new { @class = "form-control", @placeholder = "Optional" })
                </div>

                <div class="location-group">
                    <div class="col-ms-12 col-xs-12 col-sm-6 col-md-6 col-lg-6">
                        @Html.RequiredHint()
                        @Html.LabelFor(model => model.Address.City)
                        @Html.TextBoxFor(model => model.Address.City, new { @class = "form-control" })
                    </div>
                    <div class="col-ms-12 col-xs-12 col-sm-6 col-md-6 col-lg-6">
                        @Html.RequiredHint()
                        @Html.LabelFor(model => model.Address.StateProvinceId)
                        @Html.DropDownListFor(model => model.Address.StateProvinceId, Model.AvailableStateProvinces, new { @class = "form-control province-form" })
                    </div>
                </div>
                <div class="location-group">

                    <div class="col-ms-12 col-xs-12 col-sm-6 col-md-6 col-lg-6">
                        @Html.LabelFor(model => model.Address.CountryName)
                        <div class="location-display">
                            @Html.DropDownListFor(model => model.Address.CountryId, Model.AvailableCountries, new { @class = "form-control country-form" })
                        </div>
                    </div>
                    <div class="col-ms-12 col-xs-12 col-sm-6 col-md-6 col-lg-6">
                        @Html.RequiredHint()
                        @Html.LabelFor(model => model.Address.ZipPostalCode)
                        @Html.TextBoxFor(model => model.Address.ZipPostalCode, new { @class = "form-control" })
                    </div>
                </div>
                <div class="location-group">
                    <div class="location-group col-ms-12 col-xs-12 col-sm-4 col-md-4 col-lg-4">
                        @Html.LabelFor(model => model.Address.Email)
                        @Html.TextBoxFor(model => model.Address.Email, new { @class = "form-control" })
                        @Html.HiddenFor(model => model.Address.Email)
                    </div>
                    <div class="col-ms-12 col-xs-12 col-sm-6 col-md-4 col-lg-4">
                        @Html.RequiredHint()
                        @Html.LabelFor(model => model.Address.CellPhoneNumber)
                        @Html.TextBoxFor(model => model.Address.CellPhoneNumber, new { @class = "form-control" })
                    </div>
                    <div class="col-ms-12 col-xs-12 col-sm-6 col-md-4 col-lg-4">
                        @Html.LabelFor(model => model.Address.PhoneNumber)
                        @Html.TextBoxFor(model => model.Address.PhoneNumber, new { @class = "form-control", @placeholder="Optional" })
                    </div>
                </div>

                <div class="clear"></div>
            </div>
            <input type="button" class="btn btn-normal" data-action="submit" value="Continue" />
            <div class="clear"></div>
        </div>
        @if (Model.Addresses.Count > 0)
        {
            <div class="address-select-list">
                <span class="step-back"><i class="fa fa-arrow-circle-o-left"></i> Back</span>
                <h2>Select Billing Address</h2>
                <div class="address-search">
                    <table>
                        <tr><td>Search Address: </td><td><input type="text" class="form-control address-search-field" placeholder="Please enter keywords" /></td></tr>
                    </table>
                </div>
                @foreach (var address in Model.Addresses)
                {
                    <div class="address-select-item" data-action="submit" data-name="@Html.NameFor(model => model.SelectedAddressId)" data-value="@address.Value" data-name2="selectAddress" data-value2="true">
                        <div class="address-select-item-content">
                            @Html.Raw(address.Text)
                        </div>
                    </div>
                }
            </div>
        }


    </div>
}
